<?php

$page->title = 'Gallery';
$link_prefix = 'gallery/';

?>

<div class="onWallpaper">
    <h1><?= $page->title ?></h1>

    <nav class="tag-nav">
        <ul class="l-inline">
            <?php foreach($page->tags as $tag): ?>
            <li><a href="<?= url('gallery/tag/' . $tag) ?>"><?= $tag ?></a></li>
            <?php endforeach ?>
        </ul>
    </nav>

</div>

<ul class="block-grid three-up album">
    <?php foreach( $page->images as $key => $image ) : ?>
    <li>
        <figure>
            <a href="<?= url( $link_prefix . $key ) ?>">
                <img src="<?= $image->thumb ?>">
            </a>
            <figcaption>
                <?php if( isset( $image->caption )): ?>
                <p><?php echo $image->caption ?></p>
                <?php endif ?>
                <?php if( isset( $image->tags )): ?>
                <p class="footnote"><?php echo implode(', ',$image->tags) ?></p>
                <?php endif ?>
            </figcaption>
        </figure>
    </li>
    <?php endforeach ?>
</ul>
